package com.jianggujin.redis.node;

import lombok.Getter;

@Getter
public class RedisDatabase {
    private int dbIndex;
    private RedisConnection redisConnection;
    private String filter;

    public RedisDatabase(RedisConnection redisConnection, int dbIndex) {
        this.redisConnection = redisConnection;
        this.dbIndex = dbIndex;
    }

    public boolean hasFilter() {
        return filter != null && filter.length() > 0;
    }

    public void resetFilter() {
        filter = null;
    }

    public void setFilter(String filter) {
        this.filter = filter;
    }

    @Override
    public String toString() {
        return "db" + dbIndex;
    }
}
